package com.multicampus.simplewiki.util;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;

public class QueryString {
	private StringBuffer query;

	public QueryString() {
		query = new StringBuffer();
	}

	public void add(String attrib, String value) throws UnsupportedEncodingException {
		if (query.length() > 0)
			query.append("&").append(attrib).append("=").append(URLEncoder.encode(value, "euc-kr"));
		else
			query.append(attrib).append("=").append(URLEncoder.encode(value, "euc-kr"));
	}

	public String toString() {
		return query.toString();
	}

	public int length() {
		return query.length();
	}
}